import 'package:flutter/material.dart';

class ThemeChanger with ChangeNotifier {
  ThemeData _themeData;

  final _lightTheme = ThemeData.light().copyWith(
    primaryColor: Colors.blue, // appbar的背景色
    accentColor: Colors.red,
    primaryIconTheme: IconThemeData(color: Colors.white),
  );

  final _darkTheme = ThemeData.dark().copyWith(
    primaryColor: Colors.black,
    accentColor: Colors.blue,
    primaryIconTheme: IconThemeData(color: Colors.white),
    
  );

  ThemeData getTheme() => _themeData;

  void switchTheme() {
    if (_themeData == _lightTheme) {
      _themeData = _darkTheme;
    } else {
      _themeData = _lightTheme;
    }

    notifyListeners();
  }

}